<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>工资管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" href="__TMPL__/layui/css/layui.css" media="all">
	<link rel="stylesheet" href="__TMPL__/css/admin.css" media="all">
	<script type="text/javascript" src="__TMPL__/js/jquery.min.js"></script>
	<script type="text/javascript" src="__TMPL__/layui/layui.js"></script>
	<script type="text/javascript" src="__TMPL__/js/admin.js"></script>
    <script type="text/javascript" src="__TMPL__/layui/lay/modules/util.js"></script>
</head>
<body>
    <div class="layui-card" style="margin-bottom: 0;height: 170px">
        <div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list"
             style="padding: 20px 30px 0 0;">
            <blockquote class="layui-elem-quote" style="margin-left: 20px">
                姓名：<em>{$info.name}</em><br>
                总工资：<em>¥{$info.wage}</em>
                待发：<em style="color: red;">¥{$info.wage-$info.wages_paid}</em>
            </blockquote>
            <div class="layui-form-item">
                <label class="layui-form-label">发放金额</label>
                <div class="layui-input-inline">
                    <input type="text" name="amount" lay-verify="required" placeholder="本次发放金额" autocomplete="off"
                           class="layui-input">
                </div>
            </div>
            <input type="hidden" name="wage_id" value="{$info.wage_id}">
            <div class="layui-form-item layui-hide">
                <input type="button" lay-submit lay-filter="layuiadmin-app-form-submit" id="layuiadmin-app-form-submit" value="确认添加">
                <input type="button" lay-submit lay-filter="layuiadmin-app-form-edit" id="layuiadmin-app-form-edit" value="确认编辑">
            </div>
        </div>
</div>
    <script>
    layui.config({
        base: '__TMPL__/public/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form','admin'], function(){
        var $ = layui.$
            ,form = layui.form
            ,admin = layui.admin;
        //监听提交
        form.on('submit(layuiadmin-app-form-submit)', function(data){
            var field = data.field;
            var index = parent.layer.getFrameIndex(window.name);
            admin.req({
                url: "{:url('wage/do_pay')}",
                method:'post',
                type:'json',
                data:field,
                done:function (res) {
                    if(res.code===1){
                        layer.msg(res.msg, function(){
                            parent.layui.table.reload('LAY-app-content-list'); //重载表格
                            parent.layer.close(index); //再执行关闭
                        });
                    }else{
                        layer.msg(res.msg, {icon: 5});
                    }
                }
            });
        });
    })
</script>
</body>
</html>